package com.umbacos.udm.client.presenter.popup;

import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.umbacos.udm.client.model.UdmStatus;
import com.umbacos.udm.client.view.DownloadPopupView;

public class DownloadPopupPresenter {

	final private DownloadPopupView dp;
	final private UdmStatus udmStatus;
	
	public DownloadPopupPresenter(final UdmStatus udmStatus){
		this.udmStatus=udmStatus;
		dp=new DownloadPopupView();
	}

	public void bind(){
		dp.btSubmit.addClickHandler(new ClickHandler() {
			
			@Override
			public void onClick(ClickEvent event) {
				udmStatus.standardRequest("wget", dp.filename.getText(), "");
				dp.hide();
			}
		});

		dp.btCancel.addClickHandler(new ClickHandler() {

			@Override
			public void onClick(ClickEvent event) {
				dp.hide();
			}
		}); 

		dp.center();
	}
}
